<template>
	<view>
		<view class="scrolBox">
			<view class="headBox">
				<view class="tabBox">
					<view :class="{tabSonbox:index==num}" @click="qiehuan(index,item)" v-for="(item,index) in tabData" :key="index">
						<view class="tabContent">
							{{item.tabContent}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="infoBox">
			<text class="infoFont">成员昵称</text>
			<text class="infoFont">今日贡献值</text>
			<text class="infoFont">推荐下级</text>
		</view>
		<view class="memberInfo" v-for="(item,index) in list_get" :key="index">
			<view class="infonameBox">
				{{item.member_nickname}}
			</view>
			<view class="infonameBox">
				{{item.member_contribution}}
			</view>
			<view class="infonameBox">
				{{item.spread_count}}
			</view>
		</view>
	</view>
</template>

<script>
	import Require from '@/common/require.js';
	export default {
		data() {
			return {
				num:'',
				tabData: [{
						tabContent: '直属下级',
						id:'0'
					},
					{
						tabContent: '二级下属',
						id:'1'
					},
					{
						tabContent: '三级下属',
						id:'2'
					},
					{
						tabContent: '四级下属',
						id:'3'
					},
					{
						tabContent: '五级下属',
						id:'4'
					}
				],
				list_get:[],
			};
		},
		onLoad(option) {
			var self=this
			console.log(option.id)
			self.num=option.id
			self.get_list()
		},
		methods:{
			get_list(){
				var self=this
				Require.commonRequest({
					url: '/api/team/lower',
					data:{
						level:parseInt(self.num)+1
					},
					success: function(ret) {
						if(ret.data.code==200){
							self.list_get=ret.data.data.data
						}else{
							uni.showToast({
								icon: "none",
								title: ret.data.msg
							})
						}
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			qiehuan(index,item){
				var self = this
				self.num = index;
				self.get_list()
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F1F1F1;
	}

	.scrolBox {
		width: 750rpx;
		height: 85rpx;
		overflow: hidden;
	}

	.headBox {
		width: 750rpx;
		height: 95rpx;
		background: rgba(255, 255, 255, 1);
		margin-top: 1rpx;
		overflow: hidden;
		overflow-x: auto;
	}

	.tabBox {
		width: 850rpx;
		height: 79rpx;
		display: flex;

	}

	.tabSonbox {
		width: 170rpx;
		height: 76rpx;
		border-bottom: 7rpx solid #7322D8;
		font-size:28rpx;
		font-family:PingFang SC;
		font-weight:bold;
		color:rgba(115,34,216,1);
	}
	.tabContent {
		width: 170rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
	}
	.infoBox{
		width:750rpx;
		height:85rpx;
		background:rgba(255,255,255,1);
		margin-top: 10rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		}
		.infoFont{
			display: block;
			width: 250rpx;
			height: 85rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size:28rpx;
			font-family:PingFang SC;
			font-weight:bold;
			color:rgba(115,34,216,1);
			}
			.memberInfo{
				width:750rpx;
				height:100rpx;
				background:rgba(255,255,255,1);
				border-radius:10rpx;
				position: relative;
				top: 9rpx;
				margin-top: 1rpx;
				display: flex;
			}
			.infonameBox{
				width: 250rpx;
				height: 100rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size:28rpx;
				font-family:PingFang SC;
				font-weight:400;
				color:rgba(46,46,46,1);
			}
</style>
